var xmlHttp;
var la;
var lb;
function createXMLHttpRequest()
{
    if(window.ActiveXObject)
    {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
        xmlHttp=new XMLHttpRequest();
    }
}
function doRequestUsingGET(str)
{

    createXMLHttpRequest();
    var queryString="SwedenCountry.do"+"?q="+str;
    xmlHttp.onreadystatechange=handleStateChange;
    xmlHttp.open("GET",queryString,true);
    xmlHttp.send(null);
}

function handleStateChange()
{
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            xmlDoc=xmlHttp.responseXML;
            la=xmlDoc.getElementsByTagName("la")[0].childNodes[0].nodeValue;
            lb=xmlDoc.getElementsByTagName("lb")[0].childNodes[0].nodeValue;
            
            document.getElementById("serverResponse").innerHTML=xmlDoc.getElementsByTagName("la")[0].childNodes[0].nodeValue;

            var myOptions = {
                zoom: 4,
                center: new google.maps.LatLng(-33, 151),
                mapTypeId: google.maps.MapTypeId.ROADMAP
            }
            var map = new google.maps.Map(document.getElementById("map_canvas"),
                myOptions);
            var myLatLng = new google.maps.LatLng(la, lb);
            var beachMarker = new google.maps.Marker({
                position: myLatLng,
                map: map,
                title:"Hello World!"
            });
            alert("11");
        }
    }
}

function initialize() {
    createXMLHttpRequest();
    str="11";
    var queryString="CountrySelect.do"+"?q="+str;
    xmlHttp.onreadystatechange=handleStateChange;
    xmlHttp.open("GET",queryString,true);
    xmlHttp.send(null);

    
}
